<html>
<body>
<pre>
<!-- Manpage converted by man2html 3.0.1 -->

<b>WPRINTF(3)</b>	       FreeBSD Library Functions Manual 	     <b>WPRINTF(3)</b>


</pre>

<h2>NAME</h2>

<pre>
     w<b>printf</b>, <b>fwprintf</b>, <b>swprintf</b>,<b> vwprintf</b>, <b>vfwprintf,</b>  <b>vswprintf</b>
      - wide character version of formatted output conversion


</pre>

<h2>SYNOPSIS</h2>

<pre>
     <b>#include</b> <b>&lt;wchar.h&gt;</b>

     <i>int</i>
     <b>wprintf</b>(<i>const</i> <em>w</em><i>char_t</i> <i>*format</i>, <i>...</i>)

     <i>int</i>
     <b>fwprintf</b>(<i>FILE</i> <i>*stream</i>, <i>const</i> <i>wchar_t</i> <i>*format</i>, <i>...</i>)

     <i>int</i>
     <b>swprintf</b>(<i>wchar_t</i> <i>*str</i>, <i>const</i> <i>wchar_t</i> <i>*format</i>, <i>...</i>)

     <i>int</i>
     <b>vwprintf</b>(<i>const</i> <i>whar_t</i> <i>*format</i>, <i>va</i><b>_</b><i>list</i> <i>ap</i>)

     <i>int</i>
     <b>vfwprintf</b>(<i>FILE</i> <i>*stream</i>, <i>const</i> <i>wchar_t</i> <i>*format</i>, <i>va</i><b>_</b><i>list</i> <i>ap</i>)

     <i>int</i>
     <b>vswprintf</b>(<i>wchar_t</i> <i>*str</i>, <i>const</i> <i>wchar_t</i> <i>*format</i>, <i>va</i><b>_</b><i>list</i> <i>ap</i>)


</pre>

<h2>DESCRIPTION</h2>

<pre>
     The <b>wprintf</b>() family of functions produces wide character version of output
     according to a <i>format</i> as described below.  <b>wprintf</b>() and <b>vwprintf</b>() write
     output to <i>stdout,</i> the standard output stream; <b>fwprintf</b>() and <b>vfwprintf</b>()
     write output to the given output <i>stream</i>; <b>swprintf</b>(), <b>vswprintf</b>() write to
     the wide character string <i>str</i>.

     These functions write the output under the control of a <i>format</i> string
     that specifies how subsequent arguments (or arguments accessed via the
     large to hold the wide character string in the <i>ret</i> argument; This pointer
     should be passed to <b>free(3)</b> to release the allocated storage when it is no
     longer needed.

     <b>swprintf</b>() and <b>vswprintf</b>() effectively assume an infinite <i>size</i>.

     The format wide character string is composed of zero or more directives: 
     ordinary wide characters (not <b>%</b>), which are copied unchanged to the output
     stream; and conversion specifications, each of which results in fetching
     zero or more subsequent arguments. Each conversion specification is introduced
     by the character <b>%</b>. The arguments must correspond properly (after type promo-
     tion) with the conversion specifier.  After the <b>%</b>, the following appear
     in sequence:

     <b>o</b>	 An optional field, consisting of a decimal digit string followed by a
	 <b>$</b>, specifying the next argument to access .  If this field is not
	 provided, the argument following the last argument accessed will be
	 used.	Arguments are numbered starting at <b>1</b>. If unaccessed arguments
	 in the format string are interspersed with ones that are accessed the
	 results will be indeterminate.

     <b>o</b>	 Zero or more of the following flags:

	 <b>-</b>   A <b>#</b> character specifying that the value should be converted to an
	     ``alternate form''.  For <b>c</b>, <b>d</b>, <b>i</b>, <b>n</b>, <b>p</b>, <b>s</b>, and <b>u</b>, conversions,
	     this option has no effect.  For <b>o</b> conversions, the precision of
	     the number is increased to force the first character of the out-
	     put string to a zero (except if a zero value is printed with an
	     explicit precision of zero).  For <b>x</b> and <b>X</b> conversions, a non-zero
	     result has the string `0x' (or `0X' for <b>X</b> conversions) prepended
	     to it.  For <b>e</b>, <b>E</b>, <b>f</b>, <b>g</b>, and <b>G</b>, conversions, the result will al-
	     ways contain a decimal point, even if no digits follow it (nor-
	     mally, a decimal point appears in the results of those conver-
	     sions only if a digit follows).  For <b>g</b> and <b>G</b> conversions, trail-
	     ing zeros are not removed from the result as they would otherwise
	     be.

	 <b>-</b>   A zero `<b>0</b>' character specifying zero padding.  For all conver-
	     sions except <b>n</b>, the converted value is padded on the left with
	     zeros rather than blanks.	If a precision is given with a numeric
	     conversion (<b>d</b>, <b>i</b>, <b>o</b>, <b>u</b>, <b>i</b>, <b>x</b>, and <b>X</b>), the `<b>0</b>' flag is ignored.

	 <b>-</b>   A negative field width flag `<b>-</b>' indicates the converted value is
	     to be left adjusted on the field boundary.  Except for <b>n</b> conver-
	     sions, the converted value is padded on the right with blanks,
	     number produced by a signed conversion.  A `<b>+</b>' overrides a space
	     if both are used.

     <b>o</b>	 An optional decimal digit string specifying a minimum field width.
	 If the converted value has fewer characters than the field width, it
	 will be padded with spaces on the left (or right, if the left-adjust-
	 ment flag has been given) to fill out the field width.

     <b>o</b>	 An optional precision, in the form of a period `<b>.</b>' followed by an op-
	 tional digit string.  If the digit string is omitted, the precision
	 is taken as zero.  This gives the minimum number of digits to appear
	 for <b>d</b>, <b>i</b>, <b>o</b>, <b>u</b>, <b>x</b>, and <b>X</b> conversions, the number of digits to appear
	 after the decimal-point for <b>e</b>, <b>E</b>, and <b>f</b> conversions, the maximum num-
	 ber of significant digits for <b>g</b> and <b>G</b> conversions, or the maximum
	 number of characters to be printed from a string for <b>s</b> conversions.

     <b>o</b>	 The optional character <b>h</b>, specifying that a following <b>d</b>, <b>i</b>, <b>o</b>, <b>u</b>, <b>x</b>,
	 or <b>X</b> conversion corresponds to a <i>short</i> <i>int</i> or <i>unsigned</i> <i>short</i> <i>int</i> ar-
	 gument, or that a following <b>n</b> conversion corresponds to a pointer to
	 a <i>short</i> <i>int</i> argument.

     <b>o</b>	 The optional character <b>l</b> (ell) specifying that a following <b>d</b>, <b>i</b>, <b>o</b>,
	 <b>u</b>, <b>x</b>, or <b>X</b> conversion applies to a pointer to a <i>long</i> <i>int</i> or <i>unsigned</i>
	 <i>long</i> <i>int</i> argument, or that a following <b>n</b> conversion corresponds to a
	 pointer to a <i>long</i> <i>int</i> argument.

     <b>o</b>	 The optional character <b>q</b>, specifying that a following <b>d</b>, <b>i</b>, <b>o</b>, <b>u</b>, <b>x</b>,
	 or <b>X</b> conversion corresponds to a <i>quad</i> <i>int</i> or <i>unsigned</i> <i>quad</i> <i>int</i> argu-
	 ment, or that a following <b>n</b> conversion corresponds to a pointer to a
	 <i>quad</i> <i>int</i> argument.

     <b>o</b>	 The character <b>L</b> specifying that a following <b>e</b>, <b>E</b>, <b>f</b>, <b>g</b>, or <b>G</b> conver-
	 sion corresponds to a <i>long</i> <i>double</i> argument (but note that long double
	 values are not currently supported by the VAX and Tahoe compilers).

     <b>o</b>	 A character that specifies the type of conversion to be applied.

     A field width or precision, or both, may be indicated by an asterisk `*'
     or an asterisk followed by one or more decimal digits and a `$' instead
     of a digit string.  In this case, an <i>int</i> argument supplies the field
     width or precision.  A negative field width is treated as a left adjust-
     ment flag followed by a positive field width; a negative precision is
     treated as though it were missing.  If a single format directive mixes
     positional (nn$) and non-positional arguments, the results are undefined.

     The conversion specifiers and their meanings are:

     <b>diouxX</b>  The <i>int</i> (or appropriate variant) argument is converted to signed
	     decimal (<b>d</b> and <b>i</b>), unsigned octal (<b>o</b>), unsigned decimal (<b>u</b>), or
	     unsigned hexadecimal (<b>x</b> and <b>X</b>) notation.  The letters <b>abcdef</b> are
	     used for <b>x</b> conversions; the letters <b>ABCDEF</b> are used for <b>X</b> conver-
	     sions.  The precision, if any, gives the minimum number of digits

     <b>eE</b>      The <i>double</i> argument is rounded and converted in the style
	     [-]d<b>.</b>ddd<b>e</b>+-dd where there is one digit before the decimal-point
	     character and the number of digits after it is equal to the pre-
	     cision; if the precision is missing, it is taken as 6; if the
	     precision is zero, no decimal-point character appears.  An <b>E</b> con-
	     version uses the letter <b>E</b> (rather than <b>e</b>) to introduce the expo-
	     nent.  The exponent always contains at least two digits; if the
	     value is zero, the exponent is 00.

     <b>f</b>	     The <i>double</i> argument is rounded and converted to decimal notation
	     in the style [-]ddd<b>.</b>ddd, where the number of digits after the
	     decimal-point character is equal to the precision specification.
	     If the precision is missing, it is taken as 6; if the precision
	     is explicitly zero, no decimal-point character appears.  If a
	     decimal point appears, at least one digit appears before it.

     <b>g</b>	     The <i>double</i> argument is converted in style <b>f</b> or <b>e</b> (or <b>E</b> for <b>G</b> con-
	     versions).  The precision specifies the number of significant
	     digits.  If the precision is missing, 6 digits are given; if the
	     precision is zero, it is treated as 1.  Style <b>e</b> is used if the
	     exponent from its conversion is less than -4 or greater than or
	     equal to the precision.  Trailing zeros are removed from the
	     fractional part of the result; a decimal point appears only if it
	     is followed by at least one digit.

     <b>c</b>	     The <i>int</i> argument is converted to an <i>wide</i> <i>char</i>, and the resulting
             wide character is written.

     <b>s</b>	     The ``<i>wchar_t</i> <i>*</i>'' argument is expected to be a pointer to an array
	     of wide character type (pointer to a wide character string).  Wide
             characters from the array are written up to (but not including) a 
             terminating NUL character; if a precision is specified, no more than
             the number specified are written.  If a precision is given, no null
             character need be present; if the precision is not specified, or is
             greater than the size of the array, the array must contain a terminating
	     NUL character.

     <b>p</b>	     The ``<i>void</i> <i>*</i>'' pointer argument is printed in hexadecimal (as if
	     by `%#x' or `%#lx').

     <b>n</b>	     The number of characters written so far is stored into the inte-
	     ger indicated by the ``<i>int</i> <i>*</i>'' (or variant) pointer argument.  No
	     argument is converted.

     <b>%</b>	     A `%' is written. No argument is converted. The complete conver-
	     sion specification is `%%'.

     In no case does a non-existent or small field width cause truncation of a
     field; if the result of a conversion is wider than the field width, the
     field is expanded to contain the conversion result.


     To print pi to five decimal places:

	   #include &lt;math.h&gt;
	   #include &lt;stdio.h&gt;
           #include &lt;wchar.h&gt;
	   fwprintf(stdout, L&quot;pi = %.5f\n&quot;, 4 * atan(1.0));


</pre>

<h2>SEE ALSO</h2>

<pre>
     <b>printf(1)</b>, <b>scanf(3), wscanf(3)</b>


</pre>

<h2>STANDARDS</h2>

<pre>
     The <b>fwprintf</b>(), <b>wprintf</b>(), <b>swprintf</b>(), <b>vwprintf</b>(), <b>vfwprintf</b>(), and <b>vswprintf</b>()
     functions conform to ISO 9899: 1990 (``ISO C'').


</pre>

<hr>

<address>
    Man(1) output converted with <a
    href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
</address>
</body>
</html>
